<template>
  <div class="slidev-layout table-of-contents">
    <ol class="routes">
      <li v-for="(route, idx) in sections" class="route">
        <div class="number-back"></div>
        <div class="number">{{ idx + 1 }}</div>
        <div class="title">{{ route.meta.slide.title }}</div>
      </li>
    </ol>
    <div class="tip">
      <div class="tip-upper">目录</div>
      <div class="tip-lower">Contents</div>
    </div>
    <div class="line"></div>
    <img class="logo" src="../assets/logo.png">
  </div>
</template>

<script setup>
import { computed } from 'vue'

const sections = computed(() => $nav.value.slides.filter(r => r.meta.layout == 'section'))
</script>

<style lang="postcss">
.slidev-layout.table-of-contents {
  background-image: url('../assets/table-of-contents.png');
  background-size: contain;
  background-repeat: no-repeat;
  padding: 52px 70px;

  .routes {
    margin-left: 300px;
    list-style: none;
  }

  .route {
    margin-left: 0;
    margin-top: 25px;
    position: relative;
    height: 56px;
    border-radius: 6px;
    border: 1px solid rgb(168, 169, 173);
    padding: 0;
  }

  .number-back {
    position: absolute;
    left: 14px;
    top: -7px;
    width: 70px;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 7px solid rgb(0, 107, 160);
  }

  .number {
    position: absolute;
    left: 20px;
    top: -7px;
    width: 58px;
    height: 58px;
    background-color: rgb(10, 163, 212);
    line-height: 60px;
    text-align: center;
    font-size: 45px;
    font-weight: bold;
    font-family: sans-serif;
    color: white;
  }

  .title {
    margin-left: 104px;
    line-height: 56px;
    font-size: 30px;
    font-weight: bold;
  }

  .tip {
    position: absolute;
    bottom: 12px;
    left: 212px;
    background-color: rgb(10, 163, 212);
    padding: 10px 36px 4px 20px;
    color: white;

    .tip-upper {
      font-size: 28px;
      line-height: 28px;
    }

    .tip-lower {
      font-size: 20px;
      line-height: 20px;
    }
  }

  .line {
    position: absolute;
    left: 312px;
    top: -20px;
    width: 13px;
    height: 600px;
    transform: rotate(-8deg);
    background-color: rgb(10, 163, 212);
  }

  .logo {
    position: absolute;
    top: 10px;
    right: 24px;
    width: 275px;
  }
}
</style>
